#pragma once
#include "Runtime/BattleFirePrefix.h"
#define RELEASE (!_DEBUG)
#if ALICE_ANDROID
#include <jni.h>
#include <android/log.h>
#endif

#define MAX_PATH_FOR_LOG	256
#define MAX_LOG_LENGTH		10240
int InitEngineLog(const char *engineLogFilePath);
int FormatCurrDate(char *szTime,char *szDate);
void DebugLog(const char*file,int nLine,const char*format,...);//debug log
void InfoLog(const char*file,int nLine,const char*format,...);//info log
void ErrorLog(const char*file, int nLine, const char*format, ...);//normal error,need not to be displayed to user
void EditorErrorLog(const char*file, int nLine, const char*format, ...);//error log that need to display to the editor console window

void SetEngineErrorReporter(void(*foo)(const char*msg));
void ReportEngineError(const char*msg);
#if _DEBUG
#define Debug(f,...) DebugLog(__FILE__,__LINE__,f,##__VA_ARGS__)
#else
#define  Debug(f,...)
#endif
#define Error(f,...) ErrorLog(__FILE__,__LINE__,f,##__VA_ARGS__)
#define Info(f,...) InfoLog(__FILE__,__LINE__,f,##__VA_ARGS__)
#define errorC(f,...) EditorErrorLog(__FILE__,__LINE__,f,##__VA_ARGS__)
template<typename T>
void DumpBits(T&inValue)
{
    size_t byteSize=sizeof(T);
    char buffer[256]={0};
    size_t bitCount=byteSize*8;
    for(size_t i=0;i<bitCount;i++)
    {
        if((inValue>>i)&0x1)
        {
            buffer[bitCount-i-1]='1';
        }else
        {
            buffer[bitCount-i-1]='0';
        }
    }
    Debug("Dump Bits : %s",buffer);
}

